using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace sforceExplorer
{
	/// <summary>
	/// Summary description for utilityCallResults.
	/// </summary>
	public class utilityCallResults : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ListView listView1;
		private System.Windows.Forms.ColumnHeader ColumnName;
		private System.Windows.Forms.ColumnHeader ColumnValue;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.ContextMenu contextMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.ToolTip toolTip1;
		private System.ComponentModel.IContainer components;

		public utilityCallResults()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			this.listView1.Items.Clear();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
																													 "Dave",
																													 "Fafad"}, -1);
			this.listView1 = new System.Windows.Forms.ListView();
			this.ColumnName = new System.Windows.Forms.ColumnHeader();
			this.ColumnValue = new System.Windows.Forms.ColumnHeader();
			this.btnOK = new System.Windows.Forms.Button();
			this.contextMenu1 = new System.Windows.Forms.ContextMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
			this.SuspendLayout();
			// 
			// listView1
			// 
			this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																						this.ColumnName,
																						this.ColumnValue});
			this.listView1.ContextMenu = this.contextMenu1;
			this.listView1.GridLines = true;
			this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
																					  listViewItem1});
			this.listView1.LabelEdit = true;
			this.listView1.Location = new System.Drawing.Point(8, 16);
			this.listView1.Name = "listView1";
			this.listView1.Size = new System.Drawing.Size(416, 224);
			this.listView1.TabIndex = 0;
			this.toolTip1.SetToolTip(this.listView1, "Right click to copy value of selected item.");
			this.listView1.View = System.Windows.Forms.View.Details;
			// 
			// ColumnName
			// 
			this.ColumnName.Text = "Name";
			this.ColumnName.Width = 111;
			// 
			// ColumnValue
			// 
			this.ColumnValue.Text = "Value";
			this.ColumnValue.Width = 135;
			// 
			// btnOK
			// 
			this.btnOK.Location = new System.Drawing.Point(168, 256);
			this.btnOK.Name = "btnOK";
			this.btnOK.Size = new System.Drawing.Size(96, 32);
			this.btnOK.TabIndex = 1;
			this.btnOK.Text = "OK";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// contextMenu1
			// 
			this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem1});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = "&Copy Value";
			this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
			// 
			// toolTip1
			// 
			this.toolTip1.AutomaticDelay = 200;
			this.toolTip1.AutoPopDelay = 5000;
			this.toolTip1.InitialDelay = 200;
			this.toolTip1.ReshowDelay = 40;
			// 
			// utilityCallResults
			// 
			this.AcceptButton = this.btnOK;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(432, 302);
			this.ControlBox = false;
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.listView1);
			this.Name = "utilityCallResults";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "API Results";
			this.Load += new System.EventHandler(this.utilityCallResults_Load);
			this.ResumeLayout(false);

		}
		#endregion

		public void AddListViewItem(string name, string lvValue) 
		{
			ListViewItem lvi = new ListViewItem(name);
			lvi.SubItems.Add(lvValue);
			this.listView1.Items.Add(lvi);
		}

		private void btnOK_Click(object sender, System.EventArgs e)
		{
			this.Hide();
		}

		private void menuItem1_Click(object sender, System.EventArgs e)
		{
			try 
			{
				System.Windows.Forms.Clipboard.SetDataObject(this.listView1.SelectedItems[0].SubItems[1].Text);
			} 
			catch {}
		}

		private void utilityCallResults_Load(object sender, System.EventArgs e)
		{
		}

	}
}
